package cn.tonyandmoney.voicenotes.notes.filters;

import android.util.Log;

import cn.tonyandmoney.baidu.asr.entity.NluResult;
import cn.tonyandmoney.voicenotes.notes.enums.OperationEnum;
import cn.tonyandmoney.voicenotes.notes.presenter.IOperation;

/**
 * 处理输入事件的filter
 */
public class InputFilter extends BaseFilter {
    private final static String TAG = "InputFilter";
    private final static String DOMAIN = "input";

    public InputFilter(IOperation iOperation) {
        super(iOperation);
    }

    @Override
    protected String getDomain() {
        return DOMAIN;
    }

    @Override
    protected void operation(NluResult result) {
        switch (result.getIntent()) {
            case "name":
                iOperation.operation(OperationEnum.INPUT_NAME);
                break;
            case "type":
                iOperation.operation(OperationEnum.INPUT_TYPE);
                break;
            case "remark":
                iOperation.operation(OperationEnum.INPUT_MEMO);
                break;
            case "content":
                iOperation.operation(OperationEnum.INPUT_CONTENT);
                break;
            default:
                Log.i(TAG, "未实现的Intent");
                break;
        }
    }

}
